import Cookies from 'js-cookie'
import store from '@/store'

const loginDeptKey = 'login_dept'
const loginWorkAddressKey = 'login_workAddress'
const loginJobOfficeKey = 'login_jobOffice' 

/**
 * @description 获取cookie
 */
export function getDeptCookie() {
  return Cookies.get(loginDeptKey)
}
export function getWorkAddressCookie() {
  return Cookies.get(loginWorkAddressKey)
}
export function getJobOfficeCookie() {
  return Cookies.get(loginJobOfficeKey)
}

/**
 * @description 设置cookie
 * @param {*} token
 */
export function setDeptCookie(value) {
  return Cookies.set(loginDeptKey, value)
}
export function setWorkAddressCookie(value) {
  return Cookies.set(loginWorkAddressKey, value)
}
export function setJobOfficeCookie(value) {
  return Cookies.set(loginJobOfficeKey, value)
}

/**
 * 移除cookie
 */
export function removeToken(key) {
  Cookies.remove(key)
}

/**
 * 移除所有cookie
 */
export function removeAllToken() {
  Cookies.remove(loginDeptKey)
  Cookies.remove(loginWorkAddressKey)
  Cookies.remove(loginJobOfficeKey)
}
